/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uit.ieproject.business;

import java.sql.SQLException;
import java.util.ArrayList;
import uit.ieproject.dataaccess.PersonDAO;
import uit.ieproject.entities.Person;

/**
 *
 * @author Maivia
 */
public class PersonBLO {

    private PersonDAO personDAO = new PersonDAO();

    public ArrayList<Person> getAllPerson() throws SQLException {
        return personDAO.getAllPerson();
    }

    public Long addPerson(Person person) throws SQLException {
        return personDAO.addPerson(person);
    }
    
    public ArrayList<Person> getPersonById(Long id) throws SQLException {
        return personDAO.getPersonById(id);
    }
    
    public void deletePersons(long[] ids) throws SQLException {
        personDAO.deletePersons(ids);
    }

    public int checkPersonExists(String name) throws SQLException {
        return personDAO.checkPersonExists(name);
    }
    
    public ArrayList<Person> searchPersonByKeyword(String keyword) throws SQLException{
        return personDAO.searchPersonByKeyword(keyword);
    }
    
    public long getIdByName(String name)throws SQLException{
        return personDAO.getIdByName(name);
    }
    
    public String getAnswerAboutPerson(String sql)throws SQLException{
        return personDAO.getAnswerAboutPerson(sql);
    }
}
